package com.yand.disk.demo.controller;


import com.github.pagehelper.PageInfo;
import com.yand.disk.demo.entity.TDownLink;
import com.yand.disk.demo.service.LinkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;


/**
 * 链接控制器类
 */
@RestController
public class LinkController {


    @Autowired
    private LinkService linkService;


    /**
     * 跳转下载链接信息页面
     * @return
     */
    @GetMapping("link/list")
    public ModelAndView toPage(TDownLink link, Model model){

        PageInfo<TDownLink> linkPageInfo = linkService.queryLinkList(link);
        model.addAttribute("pageInfo", linkPageInfo);
        ModelAndView modelAndView = new  ModelAndView();
        modelAndView.setViewName("/link-list");
        return modelAndView;
    }

}
